import store from '../store';
//封装请求对象
// const BASE_URL = 'http://localhost:7001';
function request({ url, data, method }) {
	return new Promise((resolve, reject) => {
		uni.request({
			// url: BASE_URL + url,
			url: url,
			data,
			method,
			header: {
				// Authorization: store.state.user.token
			},
			success: ({ data, statusCode, header }) => {
				resolve(data)
			},
			fail: (error) => {
				reject(error)
			},
			// 请求结束之后的回调
			complete: () => {
				// 关闭加载loading
				uni.hideLoading();
			}
		})
	})
}

export default request;